import {
  q as n,
  p as $,
  ap as G,
  X as W,
  f as K,
  H as Q,
  av as C,
  aw as Z,
  k as t,
  m as s,
  l as u,
  as as c,
  az as ee,
  at as E,
  b6 as A,
  ay as te
} from "./index-b50e6ef9.js";
function se(d) {
  return (
    typeof d == "function" ||
    (Object.prototype.toString.call(d) === "[object Object]" && !te(d))
  );
}
function le(d) {
  const y = n([]),
    F = n([]),
    B = n({}),
    f = n(!0);
  n({}), $();
  const g = n(1),
    h = n(10),
    i = n([]),
    b = n("user_vip"),
    v = n(),
    D = G("reload"),
    I = W({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [10, 20, 30],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    w = W({
      text: "正在加载第一页...",
      viewBox: "-10, -10, 50, 50",
      spinner: `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
    }),
    S = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "user_id", minWidth: 50 },
      { label: "姓名", prop: "user_name", minWidth: 50 },
      { label: "手机号", prop: "user_phone", minWidth: 80 },
      {
        label: "等级",
        prop: "user_vip",
        minWidth: 50,
        formatter: ({ user_vip: e }) => {
          if (e == 1)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("VIP")] }
            );
          if (!e)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "info", effect: "light" },
              { default: () => [s("会员")] }
            );
        }
      },
      {
        label: "身份",
        prop: "user_place",
        minWidth: 50,
        formatter: ({ user_place: e }) => {
          if (e == 0)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("暂无")] }
            );
          if (e == 1)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星合伙人")] }
            );
          if (e == 2)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星合伙人")] }
            );
          if (e == 3)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星合伙人")] }
            );
          if (e == 4)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("四星合伙人")] }
            );
          if (e == 5)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("五星合伙人")] }
            );
          if (e == 6)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星联创")] }
            );
          if (e == 7)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星联创")] }
            );
          if (e == 8)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星联创")] }
            );
          if (e == 9)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("四星联创")] }
            );
          if (e == 10)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星董事")] }
            );
          if (e == 11)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星董事")] }
            );
          if (e == 12)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星董事")] }
            );
        }
      },
      { label: "直推数量", prop: "count", minWidth: 50 },
      {
        label: "所属战区",
        prop: "user_war",
        minWidth: 50,
        formatter: ({ user_war: e }) =>
          e
            ? t(
                u("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                se(e) ? e : { default: () => [e] }
              )
            : t(
                u("el-tag"),
                { class: "mx-1", type: "info", effect: "light" },
                { default: () => [s("暂无战区")] }
              )
      },
      {
        label: "直推展示",
        prop: "child",
        minWidth: 220,
        formatter: ({ child: e }) =>
          e.map(l =>
            t("div", null, [
              t("p", null, [
                l.user_id,
                s(" | "),
                l.user_name,
                s(" | "),
                l.user_phone,
                s(" |"),
                " ",
                l.user_vip == "0"
                  ? "普通用户"
                  : l.user_vip == "1"
                  ? "VIP用户"
                  : "",
                " ",
                " | ",
                l.user_place
                  ? l.user_place == "1"
                    ? "一星合伙人"
                    : l.user_place == "2"
                    ? "二星合伙人"
                    : l.user_place == "3"
                    ? "三星合伙人"
                    : l.user_place == "4"
                    ? "四星合伙人"
                    : l.user_place == "5"
                    ? "五星合伙人"
                    : l.user_place == "6"
                    ? "一星联创"
                    : l.user_place == "7"
                    ? "二星联创"
                    : l.user_place == "8"
                    ? "三星联创"
                    : l.user_place == "9"
                    ? "四星联创"
                    : l.user_place == "10"
                    ? "一星董事"
                    : l.user_place == "11"
                    ? "二星董事"
                    : l.user_place == "12"
                    ? "三星董事"
                    : "暂无"
                  : "暂无",
                " ",
                " | ",
                l.create_time
              ])
            ])
          )
      }
    ],
    N = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "user_id", minWidth: 80 },
      { label: "姓名", prop: "user_name", minWidth: 120 },
      { label: "手机号", prop: "user_phone", minWidth: 120 },
      {
        label: "等级",
        prop: "user_vip",
        minWidth: 80,
        formatter: ({ user_vip: e }) => {
          if (e == 1)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("VIP")] }
            );
          if (!e)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "info", effect: "light" },
              { default: () => [s("会员")] }
            );
        }
      },
      {
        label: "身份",
        prop: "user_place",
        minWidth: 80,
        formatter: ({ user_place: e }) => {
          if (e == 0)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("暂无")] }
            );
          if (e == 1)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星合伙人")] }
            );
          if (e == 2)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星合伙人")] }
            );
          if (e == 3)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星合伙人")] }
            );
          if (e == 4)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("四星合伙人")] }
            );
          if (e == 5)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("五星合伙人")] }
            );
          if (e == 6)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星联创")] }
            );
          if (e == 7)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星联创")] }
            );
          if (e == 8)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星联创")] }
            );
          if (e == 9)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("四星联创")] }
            );
          if (e == 10)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星董事")] }
            );
          if (e == 11)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星董事")] }
            );
          if (e == 12)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星董事")] }
            );
        }
      },
      { label: "直推数量", prop: "count", minWidth: 150 },
      { label: "所属战区", prop: "user_war", minWidth: 150 }
    ],
    V = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "id", minWidth: 80 },
      { label: "订单ID", prop: "order_id", minWidth: 80 },
      { label: "用户名", prop: "user_name", minWidth: 150 },
      {
        label: "身份",
        prop: "user_place",
        minWidth: 100,
        formatter: ({ user_place: e }) => {
          if (e == 0)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("暂无")] }
            );
          if (e == 1)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星合伙人")] }
            );
          if (e == 2)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星合伙人")] }
            );
          if (e == 3)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星合伙人")] }
            );
          if (e == 4)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("四星合伙人")] }
            );
          if (e == 5)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("五星合伙人")] }
            );
          if (e == 6)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星联创")] }
            );
          if (e == 7)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星联创")] }
            );
          if (e == 8)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星联创")] }
            );
          if (e == 9)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("四星联创")] }
            );
          if (e == 10)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("一星董事")] }
            );
          if (e == 11)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("二星董事")] }
            );
          if (e == 12)
            return t(
              u("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [s("三星董事")] }
            );
        }
      },
      { label: "手机号", prop: "user_phone", minWidth: 120 },
      { label: "收益", prop: "income", minWidth: 150 },
      { label: "类型", prop: "type_name", minWidth: 100 },
      { label: "来源用户", prop: "source_name", minWidth: 150 },
      { label: "来源用户手机号", prop: "source_phone", minWidth: 120 }
    ],
    J = K(() => [
      "!h-[20px]",
      "reset-margin",
      "!text-gray-500",
      "dark:!text-white",
      "dark:hover:!text-primary"
    ]);
  async function U(e) {
    const l = { order_id: e.order_id },
      r = JSON.stringify(l),
      o = { value: c.enc.Base64.stringify(c.enc.Utf8.parse(r)) },
      a = await orderDetail(o);
    a.code == 200 && ((F.value = a.data.income), (B.value = a.data.indent));
  }
  async function k(e) {
    ee(e);
  }
  async function z(e) {
    const l = { id: e.id },
      r = JSON.stringify(l),
      o = { value: c.enc.Base64.stringify(c.enc.Utf8.parse(r)) },
      a = await questionDelete(o);
    a.code == 200
      ? (E("删除成功", { type: "success" }), D())
      : E(a.msg, { type: "error" });
  }
  function L() {}
  function O(e) {
    (h.value = e), x(void 0, e);
  }
  function R(e) {
    (g.value = e), x(e, void 0);
  }
  function T(e) {}
  function j(e) {
    (w.text = `正在加载第${e}页...`),
      (f.value = !0),
      C(600).then(() => {
        f.value = !1;
      });
  }
  async function M(e, l, r = [], p) {
    (i.value = []),
      r.map(P => {
        const X = P,
          Y = new Date(X);
        i.value.push(
          Y.toLocaleDateString("zh-CN", {
            year: "numeric",
            month: "2-digit",
            day: "2-digit"
          })
        );
      }),
      (f.value = !0),
      (v.value = e);
    const o = {
        page: g.value,
        pagesize: h.value,
        user_phone: isNaN(l) ? void 0 : l,
        user_name: isNaN(l) ? l : void 0,
        start: i.value[0],
        end: i.value[1],
        type: p
      },
      a = JSON.stringify(o),
      q = { value: c.enc.Base64.stringify(c.enc.Utf8.parse(a)) },
      { data: H } = await A(q);
    (y.value = H),
      setTimeout(() => {
        f.value = !1;
      }, 500);
  }
  async function x(e = g.value, l = h.value) {
    const r = {
        page: e,
        pagesize: l,
        start: i.value[0],
        end: i.value[1],
        type: b.value
      },
      p = JSON.stringify(r),
      a = { value: c.enc.Base64.stringify(c.enc.Utf8.parse(p)) },
      m = await A(a);
    m.code === 200
      ? ((y.value = m.data),
        setTimeout(() => {
          f.value = !1;
        }, 500))
      : E(m.msg, { type: "error" });
  }
  const _ = e => {
    e && (e.resetFields(), location.reload());
  };
  return (
    Q(() => {
      C().then(() => {
        const { setWatermark: e } = Z(d.value.getTableDoms().tableWrapper);
        e("后台项目", {
          font: "16px Microsoft YaHei",
          globalAlpha: 0.8,
          forever: !0,
          width: 252,
          height: 80
        });
      }),
        x();
    }),
    {
      loading: f,
      columns: S,
      dataList: y,
      userColumns: V,
      pagination: I,
      buttonClass: J,
      userDatilList: F,
      orderInfo: B,
      columnsTable: N,
      count: g,
      pageCount: h,
      formattedDate: i,
      typeCount: v,
      gradeVip: b,
      handleLookUserDatil: U,
      onSearch: M,
      resetForm: _,
      handleaddUser: L,
      handleUpdate: k,
      handleDelete: z,
      handleSizeChange: O,
      handleCurrentChange: R,
      handleSelectionChange: T,
      onCurrentChange: j
    }
  );
}
export { le as useRole };
